/* eslint-disable operator-linebreak */
/*
 * @Author: 谢子健 1075010289@qq.com
 * @Date: 2024-09-17 21:42:24
 * @LastEditors: 谢子健 1075010289@qq.com
 * @LastEditTime: 2024-09-29 20:11:13
 * @FilePath: \ilink-vue-frontend\src\stores\fileTransStore.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// stores/fileTransStore.ts
import { validateNull } from "@/utils/validate";
import { defineStore } from "pinia";

export const useFileTransStore = defineStore("fileTransStore", {
  state: () => ({
    taskId: "" as string,
    autoChapters: [] as any[],
    keySentences: [] as any[],
    keywords: [] as string[],
    pptExtraction: {} as any,
    summarization: {} as any,
    transcription: {} as any,
    translation: {} as any,
    outputMp3Path: "" as string,
  }),
  actions: {
    setData(videoData: any) {
      if (!validateNull(videoData)) {
        const taskId = videoData?.TaskId || "";
        const autoChapters = videoData?.autoChapters?.AutoChapters || [];
        const keySentences =
        videoData?.meetingAssistance?.MeetingAssistance?.KeySentences || [];
        const keywords =
        videoData?.meetingAssistance?.MeetingAssistance?.Keywords || [];
        const pptExtraction =
        videoData?.pptExtraction?.PptExtraction || {};
        const summarization =
        videoData?.summarization?.Summarization || {};
        const transcription =
        videoData?.transcription?.Transcription || {};
        const translation = videoData?.translation?.Translation || {};
        const outputMp3Path = videoData?.outputMp3Path || "";

        this.taskId = taskId;
        this.autoChapters = autoChapters;
        this.keySentences = keySentences;
        this.keywords = keywords;
        this.pptExtraction = pptExtraction;
        this.summarization = summarization;
        this.transcription = transcription;
        this.translation = translation;
        this.outputMp3Path = outputMp3Path;
      }
      else {
        // console.log("No videoData found.");
      }
    },
  },

});
